function loadSecretMerchant() {
  request.getSecretMerchant(function(res) {
    secretMerchantClose()
    var data = {
      secretMerchant: res.secretMerchant,
      propName: propName
    }

    $('#mainContent').append(template('t_secretMerchant', data))

    var con = ''
    console.log(res.secretMerchant)
    for (var i in res.secretMerchant.props) {
      var item = res.secretMerchant.props[i]
      console.log(item)
      if (item) {
        var itemName = propName[item[0]]
        var num = item[1]
        var needPropName = propName[item[2]];
        var needNum = item[3]
        con += '<div class="itemInfo"><div class="item">' + itemName + 'X' + num + '</div>'
        con += '<div><button class="buySecretMerchant" value="' + i + '">兑换 '
        con += needPropName + 'X' + needNum + '</button></div></div>'
      }

    }
    $('#secretMerchant .content').html(con)
    var time = res.time
    $(".exit").click(function() {
      secretMerchantClose()
    })

    //获取神秘商店的物品
    $('.buySecretMerchant').click(function() {
      var value = $(this).attr('value')
      request.buySecretMerchant(value, function(res) {
        var itemId = res.itemId
        var itemNum = res.itemNum
        showMessage('你购买了' + itemNum + '个' + propName[itemId])
        loadSecretMerchant(res)
      })
    })

    function secretMerchantClose() {
      $('#secretMerchant').remove()
    }

    var ts = (new Date(time + 14400000)) - (new Date()); //计算剩余的毫秒数
    var hh = parseInt(ts / 1000 / 60 / 60 % 24); //计算剩余的小时数
    var mm = parseInt(ts / 1000 / 60 % 60); //计算剩余的分钟数
    var ss = parseInt(ts / 1000 % 60); //计算剩余的秒数
    hh = checkTime(hh);
    mm = checkTime(mm);
    ss = checkTime(ss)
    $('.timer').html("下次刷新时间 " + hh + ":" + mm + ":" + ss + "")

    var timer = setInterval(function() {
      var ts = (new Date(time + 14400000)) - (new Date()); //计算剩余的毫秒数
      var hh = parseInt(ts / 1000 / 60 / 60 % 24); //计算剩余的小时数
      var mm = parseInt(ts / 1000 / 60 % 60); //计算剩余的分钟数
      var ss = parseInt(ts / 1000 % 60); //计算剩余的秒数
      hh = checkTime(hh);
      mm = checkTime(mm);
      ss = checkTime(ss)
      $('.timer').html("下次刷新时间 " + hh + ":" + mm + ":" + ss + "")
    }, 1000)

    function checkTime(i) {
      if (i < 10) {
        i = "0" + i;
      }
      return i;
    }
  })
}
